package cn.edu.shengda;

interface ShapeArea{
    public double getArea();
    public double getPerimeter();
}

class Rectangle implements ShapeArea{
    public double width;
    public double height;
    public Rectangle(double w,double h){
        super();
        this.width=w;
        this.height=h;
    }

    public String toString(){
        return "width="+width+",height="+height
                +",perimeter="+getPerimeter()+",area="+getArea();
    }
    @Override
    public double getArea() {
        return width*height;
    }
    @Override
    public double getPerimeter() {
        return 2*(width+height);
    }
}

class Circle implements ShapeArea{
    public double R;
    public Circle(double r){
        this.R=r;
    }
    @Override
    public double getArea() {
        return 3.14*R*R;
    }
    @Override
    public double getPerimeter() {
        return 6.28*R;
    }
    public String toString(){
        return "R="+R+",perimeter="+getPerimeter()+",area="+getArea();
    }
}
class Test {
    public static void main(String [] args){
        Rectangle rectangle=new Rectangle(2,3);
        rectangle.getArea();
        System.out.println(rectangle.toString());
        Circle circle=new Circle(2);
        System.out.println(circle.toString());
    }
}